﻿@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Abp.Identity.Localization
@using Volo.Abp.Identity.Settings
@using Volo.Abp.Identity.Web.Pages.Identity.Shared
@using Volo.Abp.Settings
@model PersonalSettingsModal
@inject IHtmlLocalizer<IdentityResource> L
@inject ISettingManager SettingManager
@{
    Layout = null;
    var isUserNameUpdateEnabled = await SettingManager.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled);
    var isEmailUpdateEnabled = await SettingManager.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled);
}

<form asp-page="/Identity/Shared/PersonalSettingsModal">
    <abp-modal>
        <abp-modal-header title="@L["PersonalInfo"].Value"></abp-modal-header>
        <abp-modal-body>

            <abp-input asp-for="PersonalSettingsInfoModel.UserName" readonly="!isUserNameUpdateEnabled" />

            <abp-row>
                <abp-column size-md="_6">
                    <abp-input asp-for="PersonalSettingsInfoModel.Name" />
                </abp-column>
                <abp-column size-md="_6">
                    <abp-input asp-for="PersonalSettingsInfoModel.Surname" />
                </abp-column>
            </abp-row>

            <abp-input asp-for="PersonalSettingsInfoModel.Email" readonly="!isEmailUpdateEnabled" />

            <abp-input asp-for="PersonalSettingsInfoModel.PhoneNumber" />

        </abp-modal-body>
        <abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
    </abp-modal>
</form>